/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package arbitration.logic.validator;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author prophet
 */
public class DateValidator implements Validator{
    private SimpleDateFormat dateFormat;

    public DateValidator(){
        dateFormat=new SimpleDateFormat();
    }

    public Object isValid(String value) {
        String t=new String(value);
        if(t==null){
            return null;
        }
        t=t.trim();
        try{
            Date d=dateFormat.parse(t);
            return d;
        }catch(ParseException ex){
            return null;
        }
    }
}
